import com.niit.online.music.model.domain.Banner;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class ServiceTest {

    @Autowired
    private SongListMapper songListMapper;

    @Autowired
    private SongListService songListService;

    @Test
    public void songListMapperTest(){
        QueryWrapper<SongList> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("title","The");
        List<SongList> songLists = songListMapper.selectList(queryWrapper);
        for (SongList s : songLists) {
            System.out.println(s.toString());
        }
        Assert.assertThat(songLists, Matchers.notNullValue());//assertThat断言后面介绍
    }

    @Test
    public void songListServiceTest(){
        String title = "The";
        R r = songListService.likeTitle('%' + title + '%');
        List<SongList> data = (List<SongList>) r.getData();
        for (SongList s: data ) {
            System.out.println(s.toString());
        }
        Assert.assertTrue("测试数据正确",r.getSuccess());
    }





}
